<div class="abc" style="padding: 10px 10px 0 10px">
    <button (click)="addItem()" *ngIf="showAddItem" nz-button
            nzType="primary">
        <i
            [nzType]="'plus'" nz-icon
            theme="outline"></i>新增下级字典项
    </button>
    <button (click)="reload(); " *ngIf="showRefresh" nz-button nzType="primary">
        <i nz-icon nzType="reload"
           theme="outline"></i>刷新
    </button>
    <nz-upload
        (nzChange)="handleChange"
        [nzAccept]="['application/vnd.ms-excel','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']"
        [nzAction]="uploadUrl"
        [nzBeforeUpload]="before.bind(this)"
        [nzCustomRequest]="customRequst.bind(this)"
        [nzData]="uploadParam"
        [nzFileList]="nzFileList"
        [nzShowUploadList]="true"
        style="display: inline-block;"
    >
        <button nz-button nzType="primary"><i nz-icon nzType="upload"></i>excel导入</button>
    </nz-upload>
    <button (click)="doDownload(); "
            nz-button
            nzType="primary">
        <i nz-icon
           nzType="download"
           theme="outline"></i>excel导出
    </button>
</div>
<div class="code-tree-container">
    <base-tree
        #baseTree
        (selectNode)="selectNode($event)"
        [globalName]="'字典项'"
        [searchConfig]="baseParam"
        [showRoot]="true"
        [showSearch]="false"
        [treeNodeTemplate]="treeNodeTemplate"
    ></base-tree>
</div>
<ng-template #treeNodeTemplate let-node>
    <div [attr.aria-grabbed]="baseTree.draggable && !node.isDisabled ? true : null"
         [attr.draggable]="baseTree.draggable && !node.isDisabled ? true : null"
         [class.active]="activatedNode?.id === node.key"
         [class.draggable]="baseTree.draggable && !node.isDisabled ? true : null"
         class="tree-node"
    >
        <span *ngIf="node.origin.type === 'root'">
           <i nz-icon nzType="dr:hy-root" theme="fill"></i>
        </span>
        <span *ngIf="node.origin.type === 'leaf'">
           <i nz-icon nzType="dr:hy-terminal" theme="fill"></i>
        </span>
        <span class="title-name">{{ node.title }}
            <span *ngIf="node.origin.type==='leaf'" class="title-code">{{ '【' + node.origin.data.code + '】'}}</span>
        </span>

        <ng-container *ngIf="node.origin.type === 'leaf'">
        <span (click)="modifyClick($event, node.origin)" class="hover-icon">
                   <i nz-icon nzType="edit" theme="fill" title="修改"></i>
                </span>
            <span (nzOnConfirm)="deleteClick(node.origin)"
                  [title]="'删除'"
                  class="hover-icon"
                  nz-popconfirm
                  nzCancelText="取消"
                  nzOkText="确认"
                  nzTitle="是否删除?"><i nz-icon nzType="delete" theme="outline"></i>
        </span>
        </ng-container>
    </div>
</ng-template>
<ng-container *ngIf="_showDetailPanel">
    <base-detail
        (eventClose)="detailClose($event)"
        [baseParam]="baseParam"
        [detailPanelType]="detailPanelType"
        [height]="350"
        [name]="'字典项'"
        [record]="detailRecord"
        [schema]="schema"
        [usePopup]="true"
        [width]="550"
    >
    </base-detail>
</ng-container>
